package com.atguigu.tingshu;

import com.atguigu.tingshu.search.service.SearchService;
import org.junit.jupiter.api.Test;
import org.redisson.api.RBloomFilter;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.time.Duration;
import java.time.LocalDateTime;

@SpringBootTest
public class test {
    @Autowired
    private SearchService service;
    @Autowired
    private RedissonClient redissonClient;

    @Test
    void test(){
//        LocalDateTime now = LocalDateTime.now();
        for (long i=1611;i<=1611;i++){
            try {
                service.upperAlbum(i);
                System.out.println(i);
            } catch (Exception e) {
                System.out.println("专辑："+i+"：查询出错");
                e.printStackTrace();
            }
        }

//        LocalDateTime end = LocalDateTime.now();
//        System.out.println(Duration.between(now , end).toMillis());
    }
    @Test
    void testMongo(){
//        service.updateLatelyAlbumRanking();
        RBloomFilter<Object> bloomFilter = redissonClient.getBloomFilter("albumItemBloom");
        boolean contains = bloomFilter.contains(1611L);
        System.out.println(contains);
    }
}
